<template>
    <div class='form'>
        <el-form ref="forms" :inline="true" :model="formInline" :rules="rule"   class="demo-form-inline"  size="small">
            <div v-for="(list2,index2) in listnew" :key="index2" :class='{"rows":true,"small":uiType=="small" ? true:false}'>
                <template v-for="(item,index) in list2" >
                <div class='form_item' :key="index" v-if="item.type!='SzSteps'&&item.type!='editor'&&item.type!='file-upload'&&item.type!='signView2'" >
                    <div class='brs'  v-if="item.type=='title'">
                            <form-title :id="item.id" :data="dataNew" :index="item.index=='' ? exIndex:item.index" :dataField="dataField" :label="item.label"></form-title>
                    </div>
                     <div class='form_item_item'  style='padding-top:15px;padding-left:15px;box-sizing:border-box;height:30px' v-if="item.type=='checkbox_simple'&&dataNew.show[item.id]!='Y'"  :flag="item.id">
                            <input-checkbox ref="checkboxs" :exkey="item.exkey" :id="item.id" :value="dataNew[item.id]" :label="item.label" :data="dataNew"   @funeralItemSelectEvent="funeralItemSelectEvent"  @input="changeData" :appid="appid"></input-checkbox>
                    </div>
                    <div class='form_item_item'  v-if="item.type=='component'&&dataNew.show[item.id]!='Y'&&dataNew.show[item.id+'.'+item.index]!='Y'"  :style="item.width" :flag="item.id">
                        <el-form-item :label="item.label"  :label-width="item.labelWidth" >
                           <component ref="inputss"  :isjs="item.isjs" :widths="item.width" :fontSize="item.fontSize" :is="item.typenew" :isEdit="item.isEdit" :id="item.id" :selectData="selectData"  :isreadonly="item.isReadOnly" :dataField="dataField" :index="item.index=='' ? exIndex:item.index"  :data="dataNew" :isRequired="item.required" @input="changeData" :appid="appid" :exkey="item.exkey" :extype="item.extype"  @funeralItemSelectEvent="funeralItemSelectEvent"  :styles="item.height" :expost="item.expost"  :sign="item.sign" :time="item.time"  :postUrl="item.postUrl" :options="item.dataSource"  :valsql="item.valsql" :valsql2="item.valsql2" :sign2="item.sign2" :time2="item.time2" :attribute="item" :isMulti="item.isMulti" :url="item.valsql" :exkey3="item.exkey3" ></component>
                        </el-form-item>
                    </div>

                        <div class='form_item_item'  v-if="item.type=='checkbox_group'&&dataNew.show[item.id]!='Y'"  :flag="item.id">
                            <el-form-item :label="item.label"  :label-width="item.labelWidth" >
                                <input-checkbox-group :id="item.id" :styles="item.width" :options="item.dataSource" :isreadonly="item.isReadOnly" :index="item.index"  :data="dataNew" :isRequired="item.required" @input="changeData" :appid="appid"></input-checkbox-group>
                            </el-form-item>
                        </div>
                        
                        
                        <div class='form_item_item'  v-if="item.type=='radio'&&dataNew.show[item.id]!='Y'"  :flag="item.id" style='padding-left:45px'>
                            <input-radio :exkey="item.exkey"  :id="item.id" :label="item.label" :dataSource="item.dataSource"  :data="dataNew"  @input="changeData" :appid="appid"  @funeralItemSelectEvent="funeralItemSelectEvent" ></input-radio>
                        </div>
                        <div class='form_item_item brs'  v-if="item.type=='fuernalItemSelect'" style='width:100%'>
                            <funeral-item-select ref="funeralItemSelects" :styles="item.height" :type="item.extype" :extype="item.extype" @funeralItemSelectEvent="funeralItemSelectEvent" :data="dataNew" :appid="appid"></funeral-item-select>
                        </div>
                        <div class='form_item_item brs'  v-if="item.type=='gmfuernalItemSelect'"  style='width:100%'>
                            <gm-funeral-item-select ref="funeralItemSelects" :styles="item.height" :type="item.extype" :extype="item.extype" @funeralItemSelectEvent="funeralItemSelectEvent" :data="dataNew" :appid="appid"></gm-funeral-item-select>
                        </div>
                         <div class='form_item_item brs'  v-if="item.type=='LtStatus'"  style='width:100%'>
                            <component :is="item.type" ref="funeralItemSelects" :styles="item.height" :type="item.extype" :exkey="item.exkey" :extype="item.extype" :id="item.id"  :data="dataNew" :appid="appid"></component>
                        </div>
                        <div class='form_item_item'  v-if="item.type=='checkout_list'">
                            <check-out-list :data="dataNew" :appid="appid" :exkey="item.exkey" :oldData="oldData" ref="checkoutlist"></check-out-list>
                        </div>
                       
                        <div class='form_item_item'  v-if="item.type=='inputSelectList'&&dataNew.show[item.id]!='Y'"  :style="item.width" :flag="item.id">
                            <el-form-item :label="item.label"  :label-width="item.labelWidth" >
                                <input-select-list ref="inputSelectList" :id="item.id"  :isreadonly="item.isReadOnly" :index="item.index"  :data="dataNew" :isRequired="item.required" @input="changeData" :appid="appid" :exkey="item.exkey" :extype="item.extype" @openWin="openWin"></input-select-list>
                            </el-form-item>
                        </div>
                         
                        
                        
                        <gm-check-out-list :data="dataNew"  :appid="appid" :exkey="item.exkey" v-if="item.type=='gm_checkout_list'"></gm-check-out-list>
                        
                            <gm-check-out-list-complex  ref="checkoutlist" :data="dataNew"  :appid="appid" :exkey="item.exkey" v-if="item.type=='gm_check_out_list_complex'"></gm-check-out-list-complex>
                            <check-out-list-complex  ref="checkoutlist" :data="dataNew"  :appid="appid" :exkey="item.exkey" v-if="item.type=='check_out_list_complex'"></check-out-list-complex>
                        
                        <image-view-item :heights="item.height" v-if="item.type=='imageViewItem'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label" :width="item.width" :extype="item.extype" :exkey="item.exkey"></image-view-item>
                        <image-view-mobile :heights="item.height" v-if="item.type=='imageViewMobile'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label" :extype="item.extype" :exkey="item.exkey"></image-view-mobile>
                       <video-upload :heights="item.height" v-if="item.type=='video-upload'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid"></video-upload>
                        
                        <image-view :heights="item.height" v-if="item.type=='imageView'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid"></image-view>
                        <image-head :heights="item.height" v-if="item.type=='imageHead'&&dataNew.show[item.id]!='Y'" :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid"></image-head>
                        <image-head-view :heights="item.height" v-if="item.type=='imageHeadView'&&dataNew.show[item.id]!='Y'" :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label"></image-head-view>
                        
                        <read-card :id="item.id"   v-if="item.type=='readCard'&&dataNew.show[item.id]!='Y'"   @input="changeData" :appid="appid"></read-card>
                        <input-button-select :label="item.label"  :id="item.id" :data="data" :extype="item.extype" :exkey="item.exkey"   v-if="item.type=='inputButtonSelect'&&dataNew.show[item.id]!='Y'"   @input="changeData" :appid="appid"></input-button-select>
                        <input-button-edit :label="item.label"  :id="item.id" :data="data" :extype="item.extype" :exkey="item.exkey"   v-if="item.type=='inputEditBtn'&&dataNew.show[item.id]!='Y'"   @input="changeData" :appid="appid"></input-button-edit>
                        <input-send-msg :label="item.label"  :id="item.id" :data="data" :extype="item.extype" :exkey="item.exkey"   v-if="item.type=='inputSendMsg'&&dataNew.show[item.id]!='Y'"   @input="changeData" :appid="appid"></input-send-msg>
                       
                        <div v-if="item.type=='span'" style="float:left" v-html="item.label"></div>
                        <div style='clear:both;width:100%;height:15px' class='brs' v-if="item.type=='br'"><br/></div>



                         
                    </div>
                    <sz-steps :heights="item.height" v-if="item.type=='SzSteps'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label" :width="item.width" :extype="item.extype" :exkey="item.exkey" ></sz-steps>
                    <editor :heights="item.height" v-if="item.type=='editor'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label" :width="item.width" :extype="item.extype" :exkey="item.exkey" ></editor>
                    <log-view :heights="item.height" v-if="item.type=='log'"  :isreadonly="item.isReadOnly"  :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label" :width="item.width" :extype="item.extype" :exkey="item.exkey"  ></log-view>
                    <image-qr-code :heights="item.height" v-if="item.type=='imageQrcode'&&dataNew.show[item.id]!='Y'" :exkey="item.exkey" :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label"></image-qr-code>
                    <sign-view2 :heights="item.height" v-if="item.type=='signView2'&&dataNew.show[item.id]!='Y'" :exkey="item.exkey" :id="item.id" :data="dataNew" index=""  @input="changeData" :appid="appid" :label="item.label"></sign-view2>
                    
                    <component :isjs="item.isjs" v-if="item.type=='file-upload'" :fontSize="item.fontSize" is="file-upload" :isEdit="item.isEdit" :id="item.id" :selectData="selectData"  :isreadonly="item.isReadOnly" :dataField="dataField" :index="item.index=='' ? exIndex:item.index"  :data="dataNew" :isRequired="item.required" @input="changeData" :appid="appid" :exkey="item.exkey" :extype="item.extype"  @funeralItemSelectEvent="funeralItemSelectEvent"  :styles="item.height" :expost="item.expost"  :sign="item.sign" :time="item.time"  :postUrl="item.postUrl" :options="item.dataSource"  :valsql="item.valsql" :valsql2="item.valsql2" :sign2="item.sign2" :time2="item.time2" :attribute="item" :isMulti="item.isMulti" :url="item.valsql" :exkey3="item.exkey3" :title="item.label"></component>
                       
                </template>
            </div>
            
         </el-form>
    </div>
</template>
<script>
import Vue  from 'vue'

export default {
    props:['list','data','selectData','rules','appid','w','exIndex','dataField','oldData'],
    name: "my-form",
    components: { 
        LogView: resolve => {require(['../common/logView'], resolve)},
        FileUpload: resolve => {require(['../upload/FileUpload'], resolve)},
        MyInput: resolve => {require(['../input/myInput'], resolve)},
        InputMap: resolve => {require(['../input/input-map'], resolve)},
        InputMapButton: resolve => {require(['../input/input-map-button'], resolve)},
        InputDate: resolve => {require(['../input/input-date'], resolve)},
        InputDatetime: resolve => {require(['../input/input-datetime'], resolve)},
        CheckOutList: resolve => {require(['../byg/CheckOutList'], resolve)},
        glfSelect: resolve => {require(['../gm/glfSelect'], resolve)},
        InputNumber: resolve => {require(['../input/input-number'], resolve)},
        LtDatetime: resolve => {require(['../byg/LtDatetime'], resolve)},
        InputSimpleCheckbox: resolve => {require(['../input/input-simple-checkbox'], resolve)},
        ScanInput: resolve => {require(['../byg/ScanInput'], resolve)},
        signView: resolve => {require(['../byg/signView'], resolve)},
        signView2: resolve => {require(['../byg/signView2'], resolve)},
        InputSelect: resolve => {require(['../input/input-select'], resolve)},
        InputDateSelect: resolve => {require(['../input/input-date-select'], resolve)},
        InputDateMonth: resolve => {require(['../input/input-date-month'], resolve)},
        CitySelect: resolve => {require(['../input/city-select'], resolve)},
        InputDesk: resolve => {require(['../input/input-desk'], resolve)},
        UserSelect: resolve => {require(['../input/user-select'], resolve)},
        SelectTree: resolve => {require(['../input/SelectTree'], resolve)},
        InputRadio: resolve => {require(['../input/input-radio'], resolve)},
        InputCard: resolve => {require(['../input/input-card'], resolve)},
        InputSendMsg: resolve => {require(['../input/input-sendMsg'], resolve)},
        InputCardButton: resolve => {require(['../input/input-card-button'], resolve)},
        FuneralItemSelect: resolve => {require(['../byg/FuneralItemSelect'], resolve)},
        GmFuneralItemSelect: resolve => {require(['../gm/GmFuneralItemSelect'], resolve)},
        GmCheckOutList: resolve => {require(['../gm/GmCheckOutList'], resolve)},
        GmCheckOutListComplex: resolve => {require(['../gm/GmCheckOutListComplex'], resolve)},
        CheckOutListComplex: resolve => {require(['../byg/CheckOutListComplex'], resolve)},
        LtSelect: resolve => {require(['../byg/LtSelect'], resolve)},
        LtSelects: resolve => {require(['../byg/LtSelects'], resolve)},
        LcSelect: resolve => {require(['../byg/LcSelect'], resolve)},
        XhBatchSelect: resolve => {require(['../byg/dhtl/XhBatchSelect'], resolve)},
        ItemSelect: resolve => {require(['../byg/ItemSelect'], resolve)},
        ItemInput: resolve => {require(['../byg/ItemInput'], resolve)},
        LcSelectNew: resolve => {require(['../byg/LcSelectNew'], resolve)},
        LcSelectSimple: resolve => {require(['../byg/LcSelectSimple'], resolve)},
        lpSelect: resolve => {require(['../byg/lpSelect'], resolve)},
        GbSelect: resolve => {require(['../byg/GbSelect'], resolve)},
        InputKio: resolve => {require(['../byg/InputKio'], resolve)},
        InputSend: resolve => {require(['../input/input-send'], resolve)},
        InputCode: resolve => {require(['../input/input-code'], resolve)},
        WszgSelect: resolve => {require(['../byg/WszgSelect'], resolve)},
        ReadCard: resolve => {require(['../highShot/ReadCard'], resolve)},
        VideoUpload: resolve => {require(['../video/videoUpload'], resolve)},
        ImageView: resolve => {require(['../image/ImageView'], resolve)},
        ImageViewItem: resolve => {require(['../image/ImageViewItem'], resolve)},
        ImageViewMobile: resolve => {require(['../image/ImageViewMobile'], resolve)},
        ImageHead: resolve => {require(['../image/ImageHead'], resolve)},
        ImageHeadView: resolve => {require(['../image/ImageHeadView'], resolve)},
        imageQrCode: resolve => {require(['../image/imageQrCode'], resolve)},
        InputTextarea: resolve => {require(['../input/input-textarea'], resolve)},
        InputCheckbox: resolve => {require(['../input/input-checkbox'], resolve)},
        InputAudioSelect: resolve => {require(['../input/input-audio-select'], resolve)},
        InputCheckboxGroup: resolve => {require(['../input/input-checkbox-group'], resolve)},
        InputButtonSelect: resolve => {require(['../input/input-button-select'], resolve)},
        SzSteps: resolve => {require(['../byg/SzSteps.vue'], resolve)},
        InputButtonEdit: resolve => {require(['../input/input-button-edit'], resolve)},
        InputSelectList: resolve => {require(['../input/input-select-list'], resolve)},
        InputSelectListCustom: resolve => {require(['../input/input-select-list-custom'], resolve)},
        InputSelectMultiple: resolve => {require(['../input/input-select-multiple'], resolve)},
        editor: resolve => {require(['./editor.vue'], resolve)},
        StorageSelect: resolve => {require(['../byg/storage-select'], resolve)},
        FormTitle: resolve => {require(['./FormTitle.vue'], resolve)},
        InputQrcode: resolve => {require(['../input/input-qrcode.vue'], resolve)},
        InputYear: resolve => {require(['../input/input-year.vue'], resolve)},
       
        LtStatus: function (resolve) {
            //异步组件写法
            require(['../byg/LtStatus'], resolve)
        }
    },
    data(){
        
        return{
            formInline:{},
            dataNew:this.data,
            rule:{},
            listnew:[],
            isMobile:"N",
            fileKeys:[],
            uiType:sessionStorage.getItem("uiType")
        }
    },
    created(){
        
        
        //is-required
        
        if(localStorage.getItem("ismobile")=="Y"){
            this.isMobile="Y";
        }
        this.initList();
        
    },
     watch:{
        
       
    },
    mounted(){
        let el=document.getElementsByClassName("brs");
        for(let i=0;i<el.length;i++){
            el[i].parentNode.style.display="block";
        }
        for(let key in this.rule){
            let el=document.querySelector("div[flag='"+key+"']");
            try{
                el.classList.add("required")
            }catch(e){}
        }
    },
    
    methods:{
        openWin(data){
            this.$emit("openWinEdit",data)
        },
        initData(){
            console.log("initData==============")
            try{
                this.$refs.checkoutlist[0].initData();
            }catch(e){}
            try{
                let checkboxs=this.$refs.checkboxs;
                for(let i=0;i<checkboxs.length;i++){
                    try{
                        checkboxs[i].initData();
                    }catch(e){}
                   
                }
               
           }catch(e){}
        },
        goSearchList(){
            let el=this.$refs.inputSelectList;
            for(let i=0;i<el.length;i++){
                try{
                    el[i].goSearchList();
                }catch(e){}
                
            }
        },
       
        initList(){//主要是为了解决各个屏幕不一样，然后显示的界面不是一个正的形状
            if(!this.dataNew.show){
                this.dataNew.show={}
            }
        
            for(let i=0;i<this.rules.length;i++){
                let name=this.rules[i].name;
                let rule_=this.rules[i].rule;
                let rule__=[];
                rule__.push(rule_);
                this.rule[name]=rule__;
            }
            this.listnew=[];
            try{
                let maxWidth=600;
                try{
                    maxWidth=this.$parent.$el.clientWidth;
                }catch(e){console.log("cuow=1="+e.message)}
                if(maxWidth==0){
                    maxWidth=this.$parent.$parent.$parent.$el.clientWidth;
                }
                if(maxWidth==0){
                    let width=document.documentElement.clientWidth*0.95;
                    let w=this.w;
                    if(w.indexOf("%")){
                        w=Number(this.w.replace("%",""))/100;
                        maxWidth=width*w;
                    }else{
                        maxWidth=w;
                    }
                }
                let list_=[];
                let index=0; 
                //重新定义一个变量，为了变更这个变量的时候，this.list的值可以保持初始值
                let list__=[];
                for(let i=0;i<this.list.length;i++){
                    list__.push(this.list[i])
                }
                let indexs=0;
                //开始循环字段列表，这个列表在循环里面会慢慢的被清掉
                while(list__.length>0){
                    let type=list__[0].type;
                    let label=list__[0].label;
                    let labelWidth=list__[0].labelWidth.replace("px","").replace(";","");
                    let width=list__[0].width.replace("px","").replace("width:","").replace(";","");
                    let labelWidth_=list__.length>1 ? list__[1].labelWidth.replace("px","").replace(";",""):"0";
                    let width_=list__.length>1 ?list__[1].width.replace("px","").replace("width:","").replace(";",""):"0";
                    labelWidth=Number(labelWidth);
                    width=Number(width);
                   // labelWdidth_=Number(labelWidth_);
                    width_=Number(width_);
                    let exwidth=10;
                    if(type=='checkbox'||type=="checkbox_simple"){
                        exwidth=0
                        

                    }else if(type=="imageViewItem"){
                        width=350;
                    }
                    //console.log("label=="+label+"="+index+"="+labelWidth+"="+width+"="+maxWidth+"=1="+this.$parent.$parent.$parent.$el.clientWidth);
                    
                    //所有的隐藏域不显示控件
                    if(type!='hidden'){
                        //如果加上当前控件宽度大于了card的宽度，并且把当前控件和下一个控件换位置也大于了card的宽度，则换行
                        if(((index+width+exwidth>maxWidth)&&(index+width_+exwidth>maxWidth))||type=='br'){
                            let list2=[];
                            for(let i=0;i<list_.length;i++){
                                list2.push(list_[i])
                            } 
                            this.listnew.push(list2);//添加一行
                            indexs++;
                        
                            list_=[];
                            index=0; //当前行总宽设置为0
                        //如果加上当前控件宽度大于了card的宽度，但把当前控件和下一个控件换位置小于了card的宽度，则把下一个位置控件加入当前行然后换行
                        }else if((index+width+exwidth>maxWidth)&&(index+width_+exwidth<=maxWidth)&&labelWidth_>0&&width_>0){
                            list_.push(list__[1]);//加入下一个位置控件
                            let list2=[];
                            for(let i=0;i<list_.length;i++){
                                list2.push(list_[i])
                            }
                            this.listnew.push(list2);
                            indexs++;
                            list_=[];
                            index=0;
                            list__.splice(1,1);
                        //不加这个else if 会显示出错
                        }else if(((index+width+exwidth>maxWidth))){
                            let list2=[];
                            for(let i=0;i<list_.length;i++){
                                list2.push(list_[i])
                            }
                            this.listnew.push(list2);
                            indexs++;
                        
                            list_=[];
                            index=0; 
                        }
                        if(type!="br"){
                            list_.push(list__[0]);
                            index+=width+exwidth;
                        }
                    }
                    
                
                    list__.splice(0,1);
                }
                if(list_.length>0){
                    this.listnew.push(list_);
                }
                if(this.isMobile=="Y"){
                    window.setTimeout(function(){
                        let els=document.getElementsByClassName("form_item_item");
                        for(let i=0;i<els.length;i++){
                            els[i].style.width=(maxWidth-60)+"px";
                        }
                    },1000)
                }
                
            }catch(e){}
            this.fileKeys=[];
            for(let i=0;i<this.listnew.length;i++){
                for(let j=0;j<this.listnew[i].length;j++){
                    let typenew=this.changeComponet(this.listnew[i][j].type);
                    if(this.listnew[i][j].type=="password"){
                        this.listnew[i][j].isPassword="Y"
                    }else if(this.listnew[i][j].type=="sn"){
                        this.listnew[i][j].disableds=true;
                    }else if(this.listnew[i][j].type=="text_search"){
                        this.listnew[i][j].isSearch2="Y";
                    }else if(this.listnew[i][j].type=="select_edit"){
                        this.listnew[i][j].isEdit="Y";
                    }else if(this.listnew[i][j].type=="selectTreeMulti"){
                        this.listnew[i][j].isMulti="Y";
                    }else if(this.listnew[i][j].type=="cityselectjs"){
                        this.listnew[i][j].isjs="Y";
                    }
                    if(this.listnew[i][j].type=="imageViewItem"){
                        let exkey=this.listnew[i][j].exkey;
                        for(let h=0;h<exkey.length;h++){
                            this.fileKeys.push(exkey[h])
                        }
                    }
                    if(typenew){
                        this.listnew[i][j].type="component";
                        this.listnew[i][j].typenew=typenew
                    }
                    
                    
                }
            }
            this.$set(this.data,"fileKeys",this.fileKeys);
        },
        getDatas(id){
            let ids=id.split(".");
            let p=ids[0];
            let id_=ids[1];
            return this.dataNew[p][id_];

        },
        changeData(data){
            let datas=JSON.parse(data);
            let id=datas.id;
            let val=datas.val;
           // console.log("changeData================="+id+"="+val)
            let ids=id.split(".");
            let p=ids[0];
            let id_=ids[1];

            try{
                if(datas.index!=undefined)
                    this.dataNew[p][datas.index][id_]=val; 
                else{
                    this.dataNew[p][id_]=val;
                }
            }catch(e){}
            
            let data_={};
            data_.pre=p;
            data_.id=id_;
            data_.val=val;
            data_.index=datas.index;//用于行号
            this.$emit("input",JSON.stringify(data_));
        },
        funeralItemSelectEvent(data){//给殡仪服务特殊用的
            
            this.$emit("funeralItemSelectEvent",data);
        },
        setData(data){
            this.dataNew=data;
        },
        validate(){
           console.log("validate===========================================22")
           //try{
                let msg="";
                let isOk2=true;
                for(let i=0;i<this.list.length;i++){
                    let obj=this.list[i];
                    if(!isOk2){
                        break;
                    }
                    try{
                        if(obj.exkey3){
                            let obj2=obj.exkey3;
                            console.log(obj2,"obj2========================")
                            if(obj2.check){
                                for(let j=0;j<obj2.check.length;j++){
                                    let check=obj2.check[j];
                                    let operation=[];
                                    if(check.operation){
                                        operation=check.operation;
                                    }
                                   
                                    let isOk=true;
                                    for(let h=0;h<operation.length;h++){
                                        let oo=operation[h];
                                        let pre=oo.pre;
                                        let opr=oo.opr;
                                        let field=oo.field
                                        let val=oo.val;
                                        let val_=this.data[pre][field];
                                        if(opr=="不等于"&&val==val_){
                                            isOk=false;
                                        }
                                        if(opr=="等于"&&val!=val_){
                                            isOk=false;
                                        }
                                    }
                                    console.log("IsOk===="+isOk)
                                    if(isOk){
                                        let field=check.field;
                                        let field2=check.field2;
                                        let msg_=check.msg;
                                        let opr=check.opr;
                                        let pre=check.pre;
                                        let index=check.index;
                                        let val="";
                                        let val2="";
                                        if((index||index=='0')&&index!=undefined&&index!="undefined"){
                                            index=Number(index)
                                            if(field2&&this.data[pre][index][field2])
                                                val2=this.data[pre][index][field2]
                                        }else{
                                            if(field2&&this.data[pre][field2])
                                                val2=this.data[pre][field2]
                                        }
                                        let type=check.type;
                                        if(type=="number"){
                                            let fields=field.split(",");
                                            for(let h=0;h<fields.length;h++){
                                                let val_="";
                                                if((index||index=='0')&&index!=undefined&&index!="undefined"){
                                                    index=Number(index)
                                                    val_=this.data[pre][index][fields[h]]
                                                }else{
                                                    val_=this.data[pre][fields[h]]
                                                }    
                                               
                                                val_=Number(val_);
                                                val=Number(val)+val_;
                                            }
                                        }else{
                                            if((index||index=='0')&&index!=undefined&&index!="undefined"){
                                                index=Number(index)
                                                val=this.data[pre][index][field];
                                            }else{
                                                val=this.data[pre][field];
                                            }    
                                            
                                        }
                                        console.log("val============="+val+"=="+val2+"=="+opr)
                                        if(type=="number"){
                                             val2=Number(val2);
                                        }
                                        if(opr=="不等于"&&val==val2){
                                            isOk2=false;
                                            msg=msg_;
                                            break;
                                        }
                                        if(opr=="等于"&&val!=val2){
                                            isOk2=false;
                                            msg=msg_;
                                            break;
                                        }


                                    }
                                }
                            }
                        }
                    }catch(e){}
                    
                }
                if(!isOk2){
                    return msg;
                }
                console.log(this.rule,"rule-----------------")
                console.log(this.dataNew)
                console.log(this.data)
                for(let key in this.rule){
                    if(this.dataNew.show[key]=="Y")
                        continue;
                    try{
                       
                        let r_=this.rule[key];

                        
                        let ids=key.split(".");
                        if(ids.length>2){
                            let keys=key.split("|")
                            if(keys.length>1){
                                let key_=keys[keys.length-1];
                                key_=key_.replace("id:","");
                                ids=key_.split(".")
                            }
                        }
                        let p=ids[0];
                        let id_=ids[1];

                        
                            let val=this.dataNew[p][id_];
                        
                            if(val==""){
                                msg=r_[0].message;
                                document.getElementById(key).style.border="1px solid red"
                                break;
                            }else{
                                document.getElementById(key).style.border="1px solid #C0C4CC"
                            }
                      
                        
                    }catch(e){
                        
                    }
                    
                }

                try{
                    for(let i=0;i<this.data["fileKeys"].length;i++){
                        let file=this.data["fileKeys"][i];
                        console.log(file,"files====s=s=s=s=s=s=s===")
                        if(file.isRequired=="Y"&&file.hasData!="Y"){
                            let condition=file.condition;
                            let isOk=true;
                            if(condition&&condition.length>0){
                                condition.forEach(item => {
                                    let field=item.field.split(".");
                                    let opr=item.opr;
                                    let val=item.val;
                                    let val_=this.data[field[0]][filed[1]];
                                    if(opr=="等于"&&val!=val_){
                                        isOk=false;
                                    }
                                    if(opr=="不等于"&&val==val_){
                                        isOk=false;
                                    }
                                });
                            }
                            if(isOk){
                                msg=file.name+"附件不能为空";
                                break;
                            }
                           
                        }
                    }
                }catch(e){}

                try{
                    let elms=this.$refs.inputss;
                    console.log(elms,"elms-==========1111===1")
                    for(let i=0;i<elms.length;i++){
                        try{
                            let msg_=elms[i].validate();
                            if(msg_){
                                msg=msg_;
                            }
                        }catch(e){}
                    }
                }catch(e){}
                return msg;
          // }catch(e){
          //     return "";
          // }
           
    
        },
        changeComponet(type){
            let typenew="";
            if(type=="checkbox"){
                typenew="input-simple-checkbox"
            }else if(type=="text"){
                typenew="my-input"
            }else if(type=="input-map"){
                typenew="input-map"
            }else if(type=="input-map-button"){
                typenew="input-map-button"
            }else if(type=="input-desk"){
                typenew="input-desk"
            }else if(type=="scanAddItem"){
                typenew="scan-input"
            }else if(type=="number"){
                typenew="input-number"
            }else if(type=="sendCode"){
                typenew="input-send"
            }else if(type=="sendCode2"){
                typenew="input-code"
            }else if(type=="month"){
                typenew="input-date-month"
            }else if(type=="textarea"){
                typenew="input-textarea"
            }else if(type=="idcard"){
                typenew="input-card"
            }else if(type=="inputCardButton"){
                typenew="input-card-button"
            }else if(type=="date"){
                typenew="input-date"
            }else if(type=="inputSelecLlistCustom"){
                typenew="input-select-list-custom"
            }else if(type=="dateselect"){
                typenew="input-date-select"
            }else if(type=="datetime"){
                typenew="input-datetime"
            }else if(type=="ltDatetime"){
                typenew="lt-datetime"
            }else if(type=="cityselect"){
                typenew="city-select"
            }else if(type=="cityselectMultiple"){
                typenew="city-select-multiple"
            }else if(type=="cityselectjs"){
                typenew="city-select"
            }/*else if(type=="gm_checkout_list"){
                typenew="gm-check-out-list"
            }*/else if(type=="storageselect"){
                typenew="storage-select"
            }else if(type=="userselect"){
                typenew="user-select"
            }else if(type=="select"){
                typenew="input-select"
            }else if(type=="lcSelect"){
                typenew="lc-select"
            }else if(type=="item-select"){
                typenew="item-select"
            }else if(type=="item-input"){
                typenew="item-input"
            }else if(type=="lcSelectNew"){
                typenew="lc-select-new"
            }else if(type=="lcSelectSimple"){
                typenew="lc-select-simple"
            }else if(type=="gbSelect"){
                typenew="gb-select"
            }else if(type=="wsSelect"){
                typenew="wszg-select"
            }else if(type=="ltSelect"){
                typenew="lt-select"
            }else if(type=="signView"){
                typenew="sign-view"
            }else if(type=="ltSelects"){
                typenew="lt-selects"
            }else if(type=="lpSelect"){
                typenew="lp-select"
            }else if(type=="glfselect"){
                typenew="glf-select"
            }else if(type=="password"){
                typenew="my-input"
            }else if(type=="sn"){
                typenew="my-input"
            }else if(type=="sn"){
                typenew="text_search"
            }else if(type=="select_edit"){
                typenew="input-select"
            }else if(type=="selectTree"){
                typenew="select-tree"
            }else if(type=="selectTreeMulti"){
                typenew="select-tree"
            }else if(type=="selectmultiple"){
                typenew="input-select-multiple"
            }else if(type=='xh-batch-input-multiple'){
                typenew="xh-batch-select"
            }else if(type=="selectxm"){
                typenew="item-select"
            }else if(type=="input-kio"){
                typenew="input-kio"
            }else if(type=="qrcode"){
                typenew="input-qrcode"
            }else if(type=="capture"){
                typenew="capture"
            }else if(type=="year"){
                typenew="input-year"
            }else if(type=="inputAudioSelect"){
                typenew="input-audio-select"
            }
            return typenew;
        },
    }
}
</script>
<style scoped>
    .form>>>.el-form-item__content{
        line-height:25px;
    }
    .small{
        height:34px;
    }
    /*form{
        display:flex;
        flex-direction: row;
        display: -webkit-flex;
        justify-content: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        align-items:flex-start;
    }*/
    .rows{
        display:flex;
        flex-direction: row;
        display: -webkit-flex;
        justify-content: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        /**flex-wrap: wrap;**/
        align-items:flex-start;
       /* min-height:45px;*/
    }
    .form_item{
        box-sizing: border-box;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
       display:inline-block;
       vertical-align: middle;
       
       
    }
    .form_item_item{
      /* display:inline-block;*/
       min-height:40px;
      /* padding-top:5px;*/
    }
    .el-checkbox{
        margin-left:10px;
    }
    .el-checkbox__label{
        padding-left:5px;
    }
    .el-form-item{
        margin-bottom:1px;
        width:100%;
        display:flex;
        flex-direction: row;
    }
    .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{
        margin-bottom: 1px;
        display:flex;
        flex-direction: row;
    }
   .el-input__inner:hover{
       border-color:cornflowerblue;
   }
   .el-form-item__content{
       flex:1;
   }
   
</style>
<style >
    .el-form-item__label{
        padding:0 5px 0 0  !important;
    }
    .required .el-form-item__label::before{
          content: "*";
        color: #f56c6c;
        margin-right: 4px;
   }
.el-form--inline .el-form-item__content{
       flex:1;
   }
   .el-form-item__label{
       white-space:pre-wrap;
   }
</style>
